package LinkedList;

import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;

public class Test {
    public static void main(String[] args) {
        LinkedList<Integer>linkedList=new LinkedList<>();
        linkedList.add(20);
        linkedList.add(10);

        System.out.println("=====迭代器打印====");
        Iterator<Integer> it=linkedList.iterator();
        while(it.hasNext()){
            System.out.print(it.next()+" ");
        }
        System.out.println(linkedList);

        for (Integer x:linkedList) {
            System.out.print(x+" ");
        }
    }
}
